home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3307 < prev    next >
Encoding:
Text File  |  1996-08-06  |  946 b   |  42 lines

  1. Path: classic.iinet.com.au!news
  2. From: ng@mitswa.com.au (John A Ng)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Getting time and date?
  5. Date: Mon, 22 Jan 1996 09:38:45 GMT
  6. Organization: MITS (WA)
  7. Message-ID: <4e0i22$rhn@classic.iinet.com.au>
  8. References: <4d4bcb$3ti@hermes.louisville.edu>
  9. NNTP-Posting-Host: grunge184.nv.iinet.net.au
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. bbboon01@homer.louisville.edu (Billy Boone) wrote:
  13.  
  14. >I was wondering if there were any functions for getting the current time and 
  15. >date.  I'm using Visual C++ 1.5.
  16.  
  17. >Billy
  18.  
  19.  
  20. This is Borland C++ (a better C compiler) example:
  21.  
  22. #include <dos.h>
  23. #include <stdio.h>
  24.  
  25. int main(void)
  26. {
  27.   struct dosdate_t d;
  28.   _dos_getdate(&d);
  29.   printf("The current year is: %d\n", d.year);
  30.   printf("The current day is: %d\n", d.day);
  31.   printf("The current month is: %d\n", d.month);
  32.   return 0;
  33. }
  34.  
  35. There should be a similar thing in Visual C++.
  36. Regards,
  37.  
  38. John Ng
  39. ng@mitswa.com.au
  40. Western Australia
  41.  
  42.